package com.dahuyou.tryy.too.simulate.interpreter.parse.clazz.clazzfile.attributeinfo.impl;

import com.dahuyou.tryy.too.simulate.interpreter.parse.clazz.clazzfile.ClassReader;
import com.dahuyou.tryy.too.simulate.interpreter.parse.clazz.clazzfile.attributeinfo.AttributeInfo;
import com.dahuyou.tryy.too.simulate.interpreter.parse.clazz.clazzfile.constantpool.ConstantPool;

public class SignatureAttribute implements AttributeInfo {

    private ConstantPool constantPool;
    private int signatureIdx;

    public SignatureAttribute(ConstantPool constantPool) {
          this.constantPool = constantPool;
    }

    @Override
    public void readInfo(ClassReader reader) {
//        this.signatureIdx = reader.readUint16();
        this.signatureIdx = reader.readU2();
    }

    public String signature(){
        return this.constantPool.getUTF8(this.signatureIdx);
    }

}
